export interface MapT<T = string> {
  [propName: string]: T;
}

interface ActionMap {
  name: string;
  action: number;
}

interface Option {
  value: string;
  label: string;
}

export const stateMap: MapT = {
  1: '上架',
  2: '下架'
}

export const stateBadgeMap: MapT = {
  1: 'processing',
  2: 'default'
}

export const mapToArray = (map: MapT): Option[] => {
  return Object.keys(map).map((key: string) => {
    return { value: key, label: map[key] };
  });
}

export const stateActionMap: MapT<ActionMap> = {
  1: { name: '下架', action: 2 },
  2: { name: '上架', action: 1 }
}
